﻿
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>买入列表</title>
	<meta name="viewport" content="initial-scale=1, maximum-scale=1">
	<meta name="format-detection" content="telephone=no" />
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="stylesheet" href="css/animation.css">
	<link rel="stylesheet" href="css/light7.min.css">
	<link rel="stylesheet" href="css/light7-swipeout.css">
	<link rel="stylesheet" href="css/light7-swiper.min.css">
	<link rel="stylesheet" href="css/wap_style.css">

</head>
<style>
	#trade_buy_list .list-item {
		padding: .5rem .5rem
	}

	#trade_buy_list .list-block {
		font-size: .65rem
	}

	#trade_buy_list .hanging-body {
		font-size: .65rem;
		color: #7e7e7e;
		padding: 0 .5rem
	}

	#trade_buy_list .list-item .click-btn {
		margin-top: .25rem
	}
	#main {
	position:absolute;
	top:50px;
	left:0px;
	right:0px;
	overflow:auto;
}
</style>
<body>
<div class="page" id="trade_buy_list">
	<header class="bar bar-nav l-white">
		<a class="external icon pull-left return-icon back" href="{:url('deal_way')}">
			<img src="picture/return_gray.png" width="100%">
		</a>
		<h1 class="title"><span>买入列表</span></h1>
	</header>
	
	<div class="content infinite-scroll transfer-content" id="main">
		<div class=" list-block" >
			<div class="section" style="background-color: #fff;" id="buyorder">
				
			</div>
			<div class="infinite-scroll-preloader" id="jiazai" style="display: none;"><div class="preloader"></div></div>
			<div class="infinite-scroll-preloader" style="display: none" id="bottom"><fieldset style="border: none;border-top: 1px solid #e8e8e8 ;margin: 0 20px; "><legend style="padding: 0 10px">已经到底了</legend></fieldset></div>
		</div>
	</div>
	
</div>
<script type="text/javascript">
	var base_url = 'http://www.jiaoyi.com/',sellid=0,off_on= true;
</script>
<script type='text/javascript' src='js/jquery-3.3.1.min.js' charset='utf-8'></script>

<link rel="stylesheet" href="pub/common.css">
<script type="text/javascript" src="pub/alertPopShow.js" charset='utf-8'></script>
<script type='text/javascript' src='js/light7.min.js' charset='utf-8'></script>
<script type='text/javascript' src='js/light7-swiper.min.js' charset='utf-8'></script>
<script type='text/javascript' src='js/light7-swipeout.js' charset='utf-8'></script>
<script type='text/javascript' src='js/cn.min.js' charset='utf-8'></script>
<script type='text/javascript' src='js/layui.js' charset='utf-8'></script>
<script type='text/javascript' src='js/basis.js' charset='utf-8'></script>
</body>

<script type="text/javascript">

$('#main').scroll(function() {
	//当时滚动条离底部60px时开始加载下一页的内容
	if (($(this)[0].scrollTop + $(this).height() + 60) >= $(this)[0].scrollHeight) {
		
		//这里用 [ off_on ] 来控制是否加载 （这样就解决了 当上页的条件满足时，一下子加载多次的问题啦）
		if (off_on) {
			off_on = false;
			getbuy()
			//page++;
			//console.log("第"+page+"页");
			//LoadingDataFn();  //调用执行上面的加载方法
		}
	}
});
		function getbuy(){
			$.ajax({
				type:'post',
				url : "{:url('get_user_buy')}",
				data:{num:sellid},
				cache:false,
				dataType:'JSON',
				success:function(data){
					console.log(data)
					sellid++
					if(data.length != 0){
						var html = '';
						$.each(data,function(index, el) {
							var moneytrue = el.types ==1 ? el.money:0;
							html += '<div class="list-item bottom-line" >'
								 +    '<div class="hanging" style="align-items:center">'
								 +      '<div class="hanging-body ellipsis">'
								 +			'<div class="ellipsis">'
								 +				'<div>数量：'+el.money+'&emsp;单价：'+el.price+'</div>'
								 +				'<div>成交量：'+moneytrue+'&emsp;总量：'+el.money+'</div>'
								 +			'</div>'
								 +		'</div>'
								 +	  '<div style="text-align: center">'
								 +		'<div class="text-success"><div class="click-btn small in-block red" data-title="您确认要撤销？" data-s="TrandBuy.DelInfo" data-root="deal/index/cancel_buy" data-id="'+el.id+'" lay-click="confirm">撤销</div></div>'
								 +	  '</div>'
								 +   '</div>'
								 +  '</div>'
						});
						if(data.length<12){
							console.log(1)
							$('#jiazai').hide();
							$('#bottom').show();
						}else{
							console.log(data.length)
							$('#jiazai').show();
						}
						off_on = true;
						$('#buyorder').append(html);
					}else{
						webToast('没有啦');
					}
				},
				error:function(e){
					webToast('没有啦');
				},
				beforeSend:function(e){
					
				}
			});

		}
</script>
<script type="text/javascript">
	$(function(){
		getbuy()
	})
</script>
</html>
